#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
    int x=1;
    int y=1;
    int i,j;
    int velocity1=1;
    int velocity2=1;
    int left=0;
    int right=20;
    int top=0;
    int bottom=10;

    while(1)
    {
        for(j=0;j<=right;j++)
            printf("-");

        for(i=0;i<=bottom;i++)
            printf("|                   |\n");
        for(j=0;j<=right;j++)
            printf("-");
        system("cls");
        if(x==top||x==bottom)
            {
                velocity1=-1*velocity1;
                printf("\a");
            }
        x=x+velocity1;
        if(y==left||y==right)
            {
                velocity2=-1*velocity2;
                printf("\a");
            }
        y=y+velocity2;
        Sleep(100);
            for(i=1;i<=x;i++)
                printf("\n");
            for(j=1;j<=y;j++)
                printf(" ");
            printf("0");
            system("cls");
    }
    return 0;
}




